// XT_INT.CPP
// A simple external interface for the Editor
#include "twl.h"
#include "iostrm.h"
#include <string.h>
#include <stdlib.h>

const int GOTO_LINE = 1981, MESSAGE_BOX = 1995;

bool ide_open_file_at_line(char *file, int n, bool do_select);

char buff[256];
int n;
char *file;

class MessageWindow: public TEventWindow {
public:
	MessageWindow() : TEventWindow("yay",NULL) {}
	bool command(int id) 
    {
		get_text(buff,256);
		switch(id) {
         case GOTO_LINE:
			 n = atoi(strtok(buff," "));
			 file = strtok(NULL," ");
			 ide_open_file_at_line(file,n,true);
			 return true;
		 case MESSAGE_BOX:
			 message(buff);
			 return true;
        }
		return false;
    }
};

MessageWindow *mw;

void xt_int_initialize()
{
	mw = new MessageWindow();
	ofstream ofs("\\_ted.txt");
	ofs << mw->handle() << endl;
}

